package leetcode.code231.PowerofTwo;

public class Solution23101 extends PowerofTwo {

	@Override
	public boolean isPowerOfTwo(int n) {
		if (n <= 0)
			return false;
		int count = 0;
		while (n != 0 && count < 2) {
			if ((n & 1) == 1) {
				count++;
			}
			n = n >> 1;
		}
		return count > 1 ? false : true;
	}

	public static void main(String[] args) {
		Solution23101 so = new Solution23101();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

		for (int i = -100; i < 100; i++) {
			System.out.println(i + " " + so.isPowerOfTwo(i));
		}
	}

}
